# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=monero
pkgver=0.18.3.3
pkgrel=1
_ver_randomx=102f8acf90a7649ada410de5499a7ec62e49e1da
_ver_supercop=633500ad8c8759995049ccd022107d1fa8a1bbc9
pkgdesc="Secure, private, untraceable cryptocurrency"
url="https://getmonero.org/"
arch="all !riscv64" # build failure
license="BSD-3-Clause"
makedepends="
	boost-dev
	cmake
	cppzmq
	hidapi-dev
	libsodium-dev
	miniupnpc-dev
	openssl-dev>3
	rapidjson-dev
	readline-dev
	samurai
	unbound-dev
	zeromq-dev
	"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://github.com/monero-project/monero/archive/refs/tags/v$pkgver.tar.gz
	$pkgname-randomx-$_ver_randomx.tar.gz::https://github.com/tevador/RandomX/archive/$_ver_randomx.tar.gz
	$pkgname-supercop-$_ver_supercop.tar.gz::https://github.com/monero-project/supercop/archive/$_ver_supercop.tar.gz
	easylogging.patch
	gcc13.patch
	system-miniupnpc.patch
	version-string.patch
	"

prepare() {
	default_prepare

	rm -fr external/randomx external/supercop
	ln -s $srcdir/RandomX-$_ver_randomx external/randomx
	ln -s $srcdir/supercop-$_ver_supercop external/supercop
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DSTACK_TRACE=OFF \
		-DMANUAL_SUBMODULES=1 \
		-DARCH=default
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
26aaa02be4d1109dfdae08981b9fee16a10c358030ba99ae809eb241e805c50edc8ad10b1a375cd02e3160fa3de8ae6773cca55618d39ca30614f1d6662c18e5  monero-0.18.3.3.tar.gz
9bbe7d106a6cd518b81f3fcae7ddc78c94cc95ba7862911a0bd291755a0b6fcabcc183235befa7806945abde8160833b1fda1fa656bde6816f3d2672c5460fb5  monero-randomx-102f8acf90a7649ada410de5499a7ec62e49e1da.tar.gz
06cca8d1def31aa11bf5aa42d861c4a027786f7cc494fa3ab53a2bc4bd9d1f55b2389020ba5fd1816ed277b6e4320ad8edbb3117dcf4981fc7fba655c4bbe648  monero-supercop-633500ad8c8759995049ccd022107d1fa8a1bbc9.tar.gz
c149f1e6a6968115f95213d512116457b36665ff1159c5137dda45fa27712ce6f088b908663fb429b8e5f74e41d6cd57669db79d596564ddaca481dbdc63393e  easylogging.patch
9d1ae2b057d49abb1fcd04744069bc3898f8822db2ecf259bc6f0f8b20c4871ba9947356c548e43d2fc20aa4aa03aaf02e0052d53056028d334638c0a360842a  gcc13.patch
53c5d59a8c6a39969ca2507dd0e9cb9339c85f54ae175be4bb773d0a99ca8ba39b4aab3ffe843637395760e1b4162d6002a97242fda3bbfbad1ecccce1ecf209  system-miniupnpc.patch
411d041754bf801a4dcff6eb52d0d7fa29ad07ce673f956764b2d4b8c8252233b5f09f8833f8461be0f9b0c922748db71fecad04ae755c61ebe50113e2648485  version-string.patch
"
